package com.axjy.service.Impl;

import com.axjy.dao.UserMapper;
import com.axjy.pojo.User;
import com.axjy.service.UserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * Created by l on 2018/1/20.
 */
@Service("userService")
@Transactional
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public List<User> search(String userCode,String userName) {
        List<User> list=userMapper.search(userCode,userName);
        return list;
    }

    @Override
    public User login(String userCode, String userPass) {
        User user=userMapper.find(userCode,userPass);
        return user;
    }

    @Override
    public User get(Integer id) {
        return userMapper.getId(id);
    }

    @Override
    public void add(User u, HttpSession session) {
        userMapper.addUser(u);
    }

    @Override
    public void updateUser(User user) {
        userMapper.updateUser(user);
    }

    @Override
    public void delUser(Integer id) {
        userMapper.delUser(id);
    }
}
